<div class="layui-form">
    <div class="layui-layer-outerbox" style="margin-bottom:80px">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动代码</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                {{$activity->code}}
                <input type="hidden" name="{{makeElUniqueName('activity_id')}}" value="{{$activity->id}}" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动名称</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                {{$activity->subject}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">举办单位</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                {{$activity->getAllGroupsName()}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动图片</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                <div class="layui-big-upload-box">
                    <img id="{{makeElUniqueName('activity_upload_img')}}" src="{{ $activity->getFullPicturePath() }}">
                </div>
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label" style="width:100px">报名起始时间</label>
            <div class="layui-form-label layui-short-input" style="text-align:left;color:blue">
                {{$activity->enter_time_start}}
            </div>
            <label class="layui-form-label" style="width:100px">报名结束时间</label>
            <div class="layui-form-label layui-short-input" style="text-align:left;color:blue">
                {{$activity->enter_time_end}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动起始时间</label>
            <div class="layui-form-label layui-short-input" style="text-align:left;color:blue">
                {{$activity->active_time_start}}
            </div>
            <label class="layui-form-label" style="width:100px">活动结束时间</label>
            <div class="layui-form-label layui-short-input" style="text-align:left;color:blue">
                {{$activity->active_time_end}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动类型</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                @foreach (\App\Activity::$ACTIVITY_TYPE_MAP as $item)
                    {{ $activity->activity_type==$item['key']?$item['text']:'' }}
                @endforeach
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">总需求人数</label>
            <div class="layui-form-label layui-short-input" style="text-align:left;color:blue">
                {{$activity->volunteer_num}}
            </div>
            <label class="layui-form-label" style="width:100px">最低需求人数</label>
            <div class="layui-form-label layui-short-input" style="text-align:left;color:blue">
                {{$activity->min_volunteer_num}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动参与方式</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                @foreach (\App\Activity::$USER_JOIN_PERMIT_TYPE_MAP as $item)
                    {{ $activity->join_method==$item['key']?$item['text']:'' }}
                @endforeach
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">志愿者参与要求</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                {{$activity->volunteer_rule}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动详情</label>
            <div class="layui-form-label layui-long-input" style="text-align:left">
                {!!$activity->description!!}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动可获时长</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                {{$activity->time_length}}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px">活动举办城市</label>
            <div class="layui-form-label layui-long-input" style="text-align:left;color:blue">
                {{$activity->getAllCityName()}}
            </div>
        </div>
    </div>
    <div class="layui-dialog-bar">
        <button class="layui-btn" lay-submit lay-filter="{{makeElUniqueName('audit_success')}}"><i class="layui-icon">&#xe605;</i> 通过</button>&nbsp;
        <button class="layui-btn layui-btn-primary" onclick="layer.close(layui.popLayerUtil.index);"><i class="layui-icon">&#x1006;</i>  关闭</button>
    </div>
</div>

<script>
    layui.use(['form', 'validator', 'popLayerUtil'], function(){
        var form = layui.form();
        var $ = layui.jquery;
        var layer = layui.layer;
        var popLayerUtil = layui.popLayerUtil;

        form.on('submit({{makeElUniqueName('audit_success')}})', function(data){
            var index = layer.load(1);
            $.ajax({
                contentType: "application/json",
                type: 'post',
                url: '/backstage/api/toaudit-activity/todo',
                data: JSON.stringify({
                    activity_id: data.field['{{makeElUniqueName('activity_id')}}']
                }),
                success: function (outResult) {
                    layer.close(index);
                    if (outResult.Success) {
                        layer.msg(outResult.Message, { icon: 6 });
                        layer.close(popLayerUtil.index);
                        popLayerUtil.onClose();
                    } else {
                        layer.msg(outResult.Message, { icon: 5 });
                    }
                },
                error: function (error) {
                    layer.close(index);
                    layui.validator.processValidateError(error);
                }
            });
            return false;
        });
    });
</script>
